// ignore_for_file: must_be_immutable, camel_case_types

import 'package:flutter/cupertino.dart';
import 'package:flutter_base_plugin/base_library/base/base_function.dart';
import 'package:flutter_base_plugin_example/config/k_color.dart';
import 'package:flutter_base_plugin_example/page/details/goods/goods_details_banner.dart';
import 'package:flutter_base_plugin_example/page/details/goods/goods_details_info.dart';
import 'package:flutter_base_plugin_example/page/details/goods/goods_details_webview.dart';
import 'package:flutter_base_plugin_example/page/details/goods/vm/goods_details_view_model.dart';

class GoodsDetailsPage extends StatefulWidget {
  int id;

  GoodsDetailsPage(this.id, {Key? key}) : super(key: key);

  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _goodsDetailsPageState();
  }
}

class _goodsDetailsPageState
    extends BaseProviderState<GoodsDetailsViewModel, GoodsDetailsPage> {
  @override
  void buildCreate() {
    // TODO: implement buildCreate
    setBackgroundColor(KColors.white);
  }

  @override
  GoodsDetailsViewModel buildViewModel() {
    // TODO: implement buildViewModel
    return GoodsDetailsViewModel(widget.id);
  }

  @override
  Widget buildWidget(GoodsDetailsViewModel viewModel, BuildContext context) {
    // TODO: implement buildWidget
    return ListView(
      // shrinkWrap: true,
      // // 解决无限高度问题
      // physics: const NeverScrollableScrollPhysics(),
      padding: EdgeInsets.all(0),
      children: <Widget>[
        GoodsDetailsBanner(),
        GoodsDetailsInfo(),
        GoodsDetailsWebView(),
      ],
    );
  }
}
